package farmer.gui;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.RoundRectangle2D;

import core.gui.Button;
import farmer.game.FarmerBoyGame;
import farmer.game.TutorialState;

public class TutorialButton extends Button{
	
	private TutorialState state;

	public TutorialButton(String name, TutorialState state) {
		super(name);
		this.state = state;
		this.boundingRect = new RoundRectangle2D.Float(0, 0, 10, 10, 10, 10);
	}
	
	@Override
	public void isClicked(){
		state.getGame().enterState(FarmerBoyGame.MainMenu);
	}
	
	private BasicStroke stroke = new BasicStroke(1);
	private Font font = new Font("Button", Font.BOLD, 17);
	@Override
	protected void drawButton(Graphics2D g){
		g.setFont(font);
		int x = (int) boundingRect.getCenterX();
		int y = (int) boundingRect.getCenterY();
		int w = g.getFontMetrics().charsWidth(name.toCharArray(), 0, name.length());
		int h = g.getFontMetrics().getHeight();
		g.setColor(Color.black);
		g.setStroke(stroke);
		g.drawString(name, x-w/2, y+h/4);
		g.drawString("_", x-w/2, y+h/4);
	}

}
